/**
 * 菜单表格列
 */
import { ref } from 'vue'
import { TableColumnProps } from '../../../components/base/table/table-props'
import { menu } from '@/entity/system/menu'
export const menuType = ['目录', '菜单', '按钮']
export const endpoint = ['管理端', '用户端']
export const columns: Array<TableColumnProps<menu>> = [
  {
    title: '编号',
    customRender: ({ index }) => index + 1,
    width: 60,
    align: 'center',
  },
  {
    title: '上级菜单',
    width: 150,
    dataIndex: 'parentName',
  },
  {
    title: '菜单名称',
    width: 150,
    dataIndex: 'name',
  },
  {
    title: '显示端',
    dataIndex: 'endpoint',
    customRender: ({ record }) => endpoint[record.endpoint],
    width: 120,
  },
  {
    title: '权限',
    dataIndex: 'perms',
    width: 300,
  },
  {
    title: '类型',
    dataIndex: 'type',
    width: 70,
    customRender: ({ record }) => menuType[record.type],
  },
  {
    title: '菜单URL',
    dataIndex: 'url',
    width: 150,
  },
  {
    title: '菜单图标',
    dataIndex: 'icon',
    width: 300,
  },
  {
    title: '排序',
    width: 120,
    dataIndex: 'orderNum',
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    customRender: ({ record }) => (record.createTime ? record.createTime.replace('T', ' ') : ''),
    width: 200,
  },
  {
    title: '修改时间',
    dataIndex: 'lastUpdateTime',
    customRender: ({ record }) => (record.lastUpdateTime ? record.lastUpdateTime.replace('T', ' ') : ''),
    width: 200,
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 200,
    align: 'center',
    fixed: 'right',
  },
]
